package org.nicocube.airain.app.client.ui;

import java.util.List;

import org.nicocube.airain.app.client.AppGCServiceAsync;
import org.nicocube.airain.app.client.domain.AppGameCharacter;
import org.nicocube.airain.common.client.AirainMessenger;

import com.google.gwt.user.client.rpc.AsyncCallback;

public abstract class GameCharacterListPanelLauncher implements
		AsyncCallback<List<AppGameCharacter>> {

	private final AirainMessenger messenger;
	private final AppGCServiceAsync gcService;

	public GameCharacterListPanelLauncher(AirainMessenger messenger,
			AppGCServiceAsync gcService) {
				this.messenger = messenger;
				this.gcService = gcService;
	}

	@Override
	public void onSuccess(List<AppGameCharacter> result) {
		GameCharacterListPanel gclp = new GameCharacterListPanel(messenger,gcService);
		if (result.size() > 0) {
			for (final AppGameCharacter gc : result) {
				gclp.addRow(gc);
			}
		}
		onSuccess(gclp);
	}
	
	public abstract void onSuccess(GameCharacterListPanel result);

}
